package com.hfh.homework;

import java.util.Objects;

/**
 * @Author hfh
 * @Date 2022 09 08 19 02
 **/
public class Student implements Comparable<Student>{
    private String id;
    private String name;
    private String age;

    @Override
    public int compareTo(Student o) {
        if(Integer.valueOf(age) - Integer.valueOf(o.age)==0){
            return Integer.valueOf(id) - Integer.valueOf(o.id);
        }
        return Integer.valueOf(age) - Integer.valueOf(o.age);
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public Student(String id, String name, String age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }
}
